home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
restruc.zip
/
RESTRUC.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1993-01-04
|
2KB
|
58 lines
{è{ RESTRUC.PAS
Renames subdirectories and files, moves files to different
directories without copying the file (directory change only).
Restruc can also be used to rename files.Renaming directories
only works in DOS 3.0 or above.
Derived from Michael Toutonghi's idea in PC MAGAZINE, I
simply added error checking for no command line entry,
duplicate filenames or non-existent files. I also added
a help message that only prints if the restructure is
not successful.
Loren Cook
January 15, 1986
Compuserve 70015,1101
Copyright (c) 1986 by Loren J. Cook
Unlimited free use and reproduction of this text and the program
associated with it are hereby granted to all users provided that
no charge or levy is made for the use, copying or operation
thereof. The right to sell this text or any of the programs
associated therewith is expressly not granted to any person, firm
or corporation. }
PROGRAM Restruc;
VAR file_to_change : FILE;
PROCEDURE Help;
BEGIN
WRITELN;
LOWVIDEO; WRITELN('RESTRUC Help:');
WRITELN;
NORMVIDEO; WRITELN('RESTRUC \subdir\filename \subdir\filename');
LOWVIDEO; WRITELN('moves a file from one subdirectory to another');
WRITE('or ');
NORMVIDEO; WRITE('RESTRUC \subdir \subdir');
LOWVIDEO; WRITELN(' renames a subdirectory.');
NORMVIDEO;
HALT;
END;
BEGIN
IF PARAMSTR(1) = '' THEN Help;
ASSIGN(file_to_change, PARAMSTR(1));
{$I-}
RENAME(file_to_change, PARAMSTR(2));
{$I+}
IF IORESULT > 0 THEN BEGIN;
WRITELN;
WRITELN('Unable to find file or duplicate filename!');
Help;
END;
END.